<?php
// Note: This file is included from the library/Vanilla/Vanilla.Control.DiscussionForm.php class.
// 
// Load the category selector
if (!defined('IN_VANILLA')) exit();
$cm = $this->Context->ObjectFactory->NewContextObject($this->Context, 'CategoryManager');
$CategoryData = $cm->GetCategories(0, 1);
$cs = $this->Context->ObjectFactory->NewObject($this->Context, 'Select');
$cs->Name = 'CategoryID';
$cs->CssClass = 'CategorySelect';
// $cs->SelectedValue = ForceIncomingInt('CategoryID', $Discussion->CategoryID);
$cat = $this->Context->ObjectFactory->NewObject($this->Context, 'Category');
$LastBlocked = -1;
while ($Row = $this->Context->Database->GetRow($CategoryData)) {
	$cat->Clear();
	$cat->GetPropertiesFromDataSet($Row);
	if ($cat->Blocked != $LastBlocked && $LastBlocked != -1) {
		$cs->AddOption("-1", "---", " disabled=\"true\"");
	}
	$cs->AddOption($cat->CategoryID, $cat->Name);
	$LastBlocked = $cat->Blocked;
}
echo '<div id="Form" class="StartDiscussion">
	<div id="SplitModTools">
   <fieldset>
		'
      .$this->Get_Warnings()
      .$this->Get_PostBackForm('frmPostSplitMod', 'post', 'extension.php?PostBackAction=Split').
'<input type="hidden" value="'.$_GET['DiscussionID'].'" name="currentDisc"/><ul>';
   if ($this->Context->Configuration['USE_CATEGORIES']) {
      $this->CallDelegate('DiscussionForm_PreCategoryRender');
      $cs->Attributes = ' id="ddCategories"';
      echo '<li>
         <label for="ddCategories">'.$this->Context->GetDefinition('SelectDiscussionCategory').'</label>
         '.$cs->Get()
      .'</li>';
   } else {
      echo '<input type="hidden" name="CategoryID" value="'.$cs->aOptions[0]['IdValue'].'" />';
   }
   echo '<li>
      <label for="txtTopic">'.$this->Context->GetDefinition('EnterYourDiscussionTopic').'</label>
      <input id="txtTopic" type="text" name="Name" class="DiscussionBox" maxlength="100" value="" />
   </li>';

   
   echo '<div class="Submit">
      <input type="submit" name="btnSave" value="'.$this->Context->GetDefinition('SplitThisDiscussion').'" class="Button SubmitButton StartDiscussionButton" onclick="'
      ."Wait(this, '".$this->Context->GetDefinition('Wait')."');"
      .'"/>';

      echo '
	<a href="#" class="CancelButton">&nbsp;</a>
   </div>';
   
   
   echo'</form>
   </fieldset>
	</div>
</div>';

?>